import { createContext } from 'react';
import { TabsConfigState } from './searchPropsContext';

export interface SearchUIStateType {
  /** 当前选中的tab */
  selectShowTab?: TabsConfigState;
  // ecm搜索类型
  // 1 内容, 2 文件, 3 tag, 4 文件名, 0 内容和文件
  ecmSearchType?: number[];
  /** keyword */
  keyword?: string;
  /** 我的标签 */
  myLabels?: { LableId: string; LabelName: string; Type: number; Value: string }[];
  /** 是否展示高级搜索 */
  switchAdSearch?: boolean;
  /* 是否模糊搜索 */
  isFuzzySearch?: boolean;
  /** 是否显示搜索结果面板 */
  showSearchResultPanel?: boolean;
  /**面板id */
  panelId?: string,
  /**搜索文件夹位置 */
  searchFolder?: 'allFolder' | 'curfolder';
  /** DMS搜索文件夹ID */
  selectFolderID?: [
    {
      folderid: number;
    },
  ];
  // 遮罩打开关闭
  visibleDrawer: boolean;
  // 当前搜索的关键字(多)
  keywords: string[] | [];
  // 当前关键字
  nowText: string | undefined;
  // 是否显示内嵌的关键字图谱
  showGraph: boolean;
  // 搜索按钮实际宽度
  searchBtnWidth: number;
  fullScreen: boolean,
  showFullModal: boolean,
  historyDataLength: number,
  quickDataLength: number,
  showTag: boolean,
  showTeam: boolean,
  showPerson: boolean,
  customFolderId?: string,

}

export const SearchUIContext = createContext({
  state: {
    selectShowTab: undefined,
    ecmSearchType: undefined,
    keyword: '',
    switchAdSearch: false,
    isFuzzySearch: true,
    showSearchResultPanel: false,
    panelId: '',
    searchFolder: 'allFolder',
    keywords: [],
    nowText: undefined,
    showGraph: false,
    searchBtnWidth: 150,
    fullScreen: false,
    showFullModal: false,
    historyDataLength: 0,
    quickDataLength: 0,
    showTag: true,
    showTeam: true,
    showPerson: true
  },
} as {
  state: SearchUIStateType;
  updateUIState: (state: Partial<SearchUIStateType>) => void;
});
